/*
 * This file is part of JContextFree.
 *
 * JContextFree is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * JContextFree is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with JContextFree.  If not, see <http://www.gnu.org/licenses/>.
 */

package it.enricod.jcontextfree.gui.paint.java2d;

import it.enricod.jcontextfree.engine.model.IFigure;
import it.enricod.jcontextfree.engine.model.IPaint;
import it.enricod.jcontextfree.gui.paint.IFigurePainter;
import it.enricod.jcontextfree.gui.paint.IPainter;
import it.enricod.jcontextfree.gui.paint.PainterFactory;

import java.awt.image.BufferedImage;
import java.util.List;

import org.apache.log4j.Logger;

public class Java2DPainter implements IPainter
{
	private Logger logger = Logger.getLogger(Java2DPainter.class.getName());

	public Java2DPainter()
	{
	}

	public void paint(BufferedImage destBufferedImage, IPaint paint)
	{
		List<IFigure> figures = paint.getFigures();
		for (IFigure figure : figures)
		{
			IFigurePainter painter = PainterFactory.getPainter(figure);
			painter.draw(destBufferedImage);
		}
	}

}
